<html><head><meta http-equiv="content-type" content="text/html; charset=utf-8"> <style>
	.KEYW {color: #933;}
	.COMM {color: #bbb; font-style: italic;}
	.NUMB {color: #393;}
	.STRN {color: #393;}
	.REGX {color: #339;}
	.line {border-right: 1px dotted #666; color: #666; font-style: normal;}
	</style></head><body><pre><span class='line'>  1</span> <span class="COMM">/**
<span class='line'>  2</span>  * @fileOverview 通用单级菜单。
<span class='line'>  3</span>  * @version 0.8.0.0
<span class='line'>  4</span>  * @author Direct Guo
<span class='line'>  5</span>  */</span><span class="WHIT">
<span class='line'>  6</span> 
<span class='line'>  7</span> </span><span class="COMM">/**
<span class='line'>  8</span>  * 单级菜单类
<span class='line'>  9</span>  * @description 1、可以为多行多列多页。
<span class='line'> 10</span>  * @description 2、封装了跳转、翻页、换行等常用菜单行为。
<span class='line'> 11</span>  * @description 3、只能用于一级菜单
<span class='line'> 12</span>  * @class
<span class='line'> 13</span>  * @param {int} w 菜单横向最大条目数，为空则使用默认值5
<span class='line'> 14</span>  * @param {int} h 菜单纵向最大条目数，为空则使用默认值3
<span class='line'> 15</span>  * @param {int} length 菜单的总数量，为空则使用默认值15
<span class='line'> 16</span>  * @property {int} i 当前选中项的序号
<span class='line'> 17</span>  * @property {int} w 菜单横向最大条目数
<span class='line'> 18</span>  * @property {int} h 菜单纵向最大条目数
<span class='line'> 19</span>  * @property {int} length 菜单的总数量
<span class='line'> 20</span>  * @property {boolean} defkey 是否响应默认按键
<span class='line'> 21</span>  * @example
<span class='line'> 22</span> 
<span class='line'> 23</span> 说明：
<span class='line'> 24</span>  1.此类需要jQuery和common.js支持， 请保证html中加载这两项
<span class='line'> 25</span>  2.此菜单只管理菜单行为逻辑，不管理数据和现实逻辑，数据和显示需要根据不同接口或者页面具体编写
<span class='line'> 26</span>  3.具体项目代码请看T12下的 巴巴变相册，其中login和bigphoto是单页菜单、album和photolist 是多页菜单
<span class='line'> 27</span> 
<span class='line'> 28</span> 
<span class='line'> 29</span> // = 第一步 =  HTML中引入jquery、common.js、menu_a.js
<span class='line'> 30</span> 
<span class='line'> 31</span> 
<span class='line'> 32</span> // = 第二步 =
<span class='line'> 33</span> 
<span class='line'> 34</span> //定义login对象为一个菜单, 此菜单宽度为1,高度为3,总菜单项为3, 此菜单是一个单页菜单。
<span class='line'> 35</span> //使用jQuery的extend方法，给新建的菜单对象加上特有方法和属性。
<span class='line'> 36</span> var login = $.extend(new Menu_A(1, 3, 3), {
<span class='line'> 37</span> 	//定义打开菜单时的操作
<span class='line'> 38</span>     onOpen: function(){
<span class='line'> 39</span>         common.log(this.name + " onOpen!")
<span class='line'> 40</span> 		//绘制数据和焦点，具体见下方
<span class='line'> 41</span>         this.drawFocus();
<span class='line'> 42</span>         this.drawData();
<span class='line'> 43</span> 		//显示login框
<span class='line'> 44</span>         this.show();
<span class='line'> 45</span>     },
<span class='line'> 46</span> 	//定义打开菜单项改变时的操作
<span class='line'> 47</span>     onChange: function(){
<span class='line'> 48</span>         common.log(this.name + " onChange! " + this.i)
<span class='line'> 49</span> 		//绘制焦点，见下方
<span class='line'> 50</span>         this.drawFocus();
<span class='line'> 51</span>     },
<span class='line'> 52</span> 	//定义进入菜单项时的操作
<span class='line'> 53</span>     onEnter: function(){
<span class='line'> 54</span>         common.log(this.name + " onEnter! " + this.i)
<span class='line'> 55</span>         var self = this;
<span class='line'> 56</span> 		//根据进入的项目分开操作
<span class='line'> 57</span>         switch (this.i) {
<span class='line'> 58</span>             case 0:
<span class='line'> 59</span>             case 1:
<span class='line'> 60</span>                 //用户名密码输入时
<span class='line'> 61</span> 				//...
<span class='line'> 62</span>                 break;
<span class='line'> 63</span>             case 2:
<span class='line'> 64</span>                 //确定时
<span class='line'> 65</span> 				//...
<span class='line'> 66</span>                 break;
<span class='line'> 67</span>         }
<span class='line'> 68</span>     },
<span class='line'> 69</span> 	//其余事件因为在这个login框中使用不到，所以可以不定义
<span class='line'> 70</span> 	
<span class='line'> 71</span> 	
<span class='line'> 72</span> 	//附加属性和功能，此处为在页面中显示菜单的相关逻辑
<span class='line'> 73</span> 	
<span class='line'> 74</span>     dom: null, //存储指向login框DOM的jquery对象
<span class='line'> 75</span>     name: "登陆框", //分辨对象的作用，不是必须
<span class='line'> 76</span>     data: ["gavin2026cn@163.com", "o1nscEN2"], //储存用户名密码
<span class='line'> 77</span>     //显示login框
<span class='line'> 78</span>     show: function(){
<span class='line'> 79</span>         this.dom.show();
<span class='line'> 80</span>     },
<span class='line'> 81</span>     //隐藏login框
<span class='line'> 82</span>     hide: function(){
<span class='line'> 83</span>         this.dom.hide();
<span class='line'> 84</span>     },
<span class='line'> 85</span> 	//绘制焦点，给当前选中项加current样式，根据页面结构编写
<span class='line'> 86</span>     drawFocus: function(){
<span class='line'> 87</span>         var items = this.dom.find("li")
<span class='line'> 88</span>         items.filter(".current").removeClass("current");
<span class='line'> 89</span>         items.eq(this.i).addClass("current");
<span class='line'> 90</span>     },
<span class='line'> 91</span> 	//绘制数据，此处为用户名密码，根据页面结构编写
<span class='line'> 92</span>     drawData: function(){
<span class='line'> 93</span>         var items = this.dom.find("li")
<span class='line'> 94</span>         items.eq(0).find(".albumsLoginInput").html(this.data[0]);
<span class='line'> 95</span>         items.eq(1).find(".albumsLoginInput").html(this.data[1]);
<span class='line'> 96</span>     },
<span class='line'> 97</span> })
<span class='line'> 98</span> 
<span class='line'> 99</span> // = 第三步 = 在页面加载结束后，进行初始化
<span class='line'>100</span> 
<span class='line'>101</span> $(function(){
<span class='line'>102</span> 	//启用通用键盘管理
<span class='line'>103</span> 	common.key.init();
<span class='line'>104</span> 	
<span class='line'>105</span> 	//绑定dom
<span class='line'>106</span>     login.dom = $(".albumsLogin");
<span class='line'>107</span> 	
<span class='line'>108</span> 	//启动login窗口，到此，就可以登陆窗口就可以控制了
<span class='line'>109</span>     login.open();
<span class='line'>110</span>     
<span class='line'>111</span> })
<span class='line'>112</span> 
<span class='line'>113</span> //具体项目代码请看T12下的 巴巴变相册，其中album和photolist 是多页菜单
<span class='line'>114</span>  */</span><span class="WHIT">
<span class='line'>115</span> </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">Menu_A</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">w</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">h</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">length</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>116</span> </span><span class="WHIT">    </span><span class="NAME">this.w</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">w</span><span class="WHIT"> </span><span class="PUNC">||</span><span class="WHIT"> </span><span class="NAME">this.w</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>117</span> </span><span class="WHIT">    </span><span class="NAME">this.h</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">h</span><span class="WHIT"> </span><span class="PUNC">||</span><span class="WHIT"> </span><span class="NAME">this.h</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>118</span> </span><span class="WHIT">    </span><span class="NAME">this.length</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">length</span><span class="WHIT"> </span><span class="PUNC">||</span><span class="WHIT"> </span><span class="NAME">this.length</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>119</span> </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>120</span> 
<span class='line'>121</span> </span><span class="NAME">Menu_A.prototype</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>122</span> </span><span class="WHIT">    </span><span class="COMM">/**
<span class='line'>123</span>      * 检查i必须为正整数,否则返回当前i
<span class='line'>124</span>      * @private
<span class='line'>125</span>      * @function
<span class='line'>126</span>      * @param {int} i 被检查的变量
<span class='line'>127</span>      * @returns {int} 检查后的数
<span class='line'>128</span>      */</span><span class="WHIT">
<span class='line'>129</span> </span><span class="WHIT">    </span><span class="NAME">checki</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">i</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>130</span> </span><span class="WHIT">        </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="KEYW">typeof</span><span class="PUNC">(</span><span class="NAME">i</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">!=</span><span class="WHIT"> </span><span class="STRN">"number"</span><span class="WHIT"> </span><span class="PUNC">||</span><span class="WHIT"> </span><span class="NAME">i</span><span class="WHIT"> </span><span class="PUNC">&lt;</span><span class="WHIT"> </span><span class="NUMB">0</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">?</span><span class="WHIT"> </span><span class="NAME">this.i</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="NAME">Math.floor</span><span class="PUNC">(</span><span class="NAME">i</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT"> </span><span class="COMM">//无i则返回当前焦点页信息</span><span class="WHIT">
<span class='line'>131</span> </span><span class="WHIT">    </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>132</span> </span><span class="WHIT">    </span><span class="COMM">/**
<span class='line'>133</span>      * 将页行列对象形式储存的项目转换为项目序号
<span class='line'>134</span>      * @private
<span class='line'>135</span>      * @function
<span class='line'>136</span>      * @param {object} m 格式为{x:a,y:b,z:c}的对象，其中a为列编号，b为所在页行编号，c为页编号
<span class='line'>137</span>      * @returns {int} 项目序号
<span class='line'>138</span>      */</span><span class="WHIT">
<span class='line'>139</span> </span><span class="WHIT">    </span><span class="NAME">xyz2i</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">m</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>140</span> </span><span class="WHIT">        </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">x</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">m.x</span><span class="WHIT"> </span><span class="PUNC">==</span><span class="WHIT"> </span><span class="KEYW">null</span><span class="WHIT"> </span><span class="PUNC">?</span><span class="WHIT"> </span><span class="NUMB">0</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="NAME">m.x</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>141</span> </span><span class="WHIT">        </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">y</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">m.y</span><span class="WHIT"> </span><span class="PUNC">==</span><span class="WHIT"> </span><span class="KEYW">null</span><span class="WHIT"> </span><span class="PUNC">?</span><span class="WHIT"> </span><span class="NUMB">0</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="NAME">m.y</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>142</span> </span><span class="WHIT">        </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">z</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">m.z</span><span class="WHIT"> </span><span class="PUNC">==</span><span class="WHIT"> </span><span class="KEYW">null</span><span class="WHIT"> </span><span class="PUNC">?</span><span class="WHIT"> </span><span class="NUMB">0</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="NAME">m.z</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>143</span> </span><span class="WHIT">        </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">x</span><span class="WHIT"> </span><span class="PUNC">&lt;</span><span class="WHIT"> </span><span class="NUMB">0</span><span class="WHIT"> </span><span class="PUNC">||</span><span class="WHIT"> </span><span class="NAME">x</span><span class="WHIT"> </span><span class="PUNC">>=</span><span class="WHIT"> </span><span class="NAME">this.w</span><span class="WHIT"> </span><span class="PUNC">||</span><span class="WHIT"> </span><span class="NAME">y</span><span class="WHIT"> </span><span class="PUNC">&lt;</span><span class="WHIT"> </span><span class="NUMB">0</span><span class="WHIT"> </span><span class="PUNC">||</span><span class="WHIT"> </span><span class="NAME">y</span><span class="WHIT"> </span><span class="PUNC">>=</span><span class="WHIT"> </span><span class="NAME">this.h</span><span class="WHIT"> </span><span class="PUNC">||</span><span class="WHIT"> </span><span class="NAME">z</span><span class="WHIT"> </span><span class="PUNC">&lt;</span><span class="WHIT"> </span><span class="NUMB">0</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>144</span> </span><span class="WHIT">            </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="KEYW">false</span><span class="WHIT">
<span class='line'>145</span> </span><span class="WHIT">        </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>146</span> </span><span class="WHIT">        </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">z</span><span class="WHIT"> </span><span class="PUNC">*</span><span class="WHIT"> </span><span class="NAME">this.p</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="NAME">y</span><span class="WHIT"> </span><span class="PUNC">*</span><span class="WHIT"> </span><span class="NAME">this.w</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="NAME">x</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>147</span> </span><span class="WHIT">    </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>148</span> </span><span class="WHIT">    </span><span class="COMM">/**
<span class='line'>149</span>      * 将行列对象形式储存的项目转换为项目序号
<span class='line'>150</span>      * @private
<span class='line'>151</span>      * @function
<span class='line'>152</span>      * @param {object} m 格式为{x:a,y:b}的对象，其中a为列编号，b为行编号
<span class='line'>153</span>      * @returns {int} 项目序号
<span class='line'>154</span>      */</span><span class="WHIT">
<span class='line'>155</span> </span><span class="WHIT">    </span><span class="NAME">xy2i</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">m</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>156</span> </span><span class="WHIT">        </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">x</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">m.x</span><span class="WHIT"> </span><span class="PUNC">==</span><span class="WHIT"> </span><span class="KEYW">null</span><span class="WHIT"> </span><span class="PUNC">?</span><span class="WHIT"> </span><span class="NUMB">0</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="NAME">m.x</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>157</span> </span><span class="WHIT">        </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">y</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">m.y</span><span class="WHIT"> </span><span class="PUNC">==</span><span class="WHIT"> </span><span class="KEYW">null</span><span class="WHIT"> </span><span class="PUNC">?</span><span class="WHIT"> </span><span class="NUMB">0</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="NAME">m.y</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>158</span> </span><span class="WHIT">        </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">x</span><span class="WHIT"> </span><span class="PUNC">&lt;</span><span class="WHIT"> </span><span class="NUMB">0</span><span class="WHIT"> </span><span class="PUNC">||</span><span class="WHIT"> </span><span class="NAME">x</span><span class="WHIT"> </span><span class="PUNC">>=</span><span class="WHIT"> </span><span class="NAME">this.w</span><span class="WHIT"> </span><span class="PUNC">||</span><span class="WHIT"> </span><span class="NAME">y</span><span class="WHIT"> </span><span class="PUNC">&lt;</span><span class="WHIT"> </span><span class="NUMB">0</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>159</span> </span><span class="WHIT">            </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="KEYW">false</span><span class="WHIT">
<span class='line'>160</span> </span><span class="WHIT">        </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>161</span> </span><span class="WHIT">        </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">y</span><span class="WHIT"> </span><span class="PUNC">*</span><span class="WHIT"> </span><span class="NAME">this.w</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="NAME">x</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>162</span> </span><span class="WHIT">    </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>163</span> </span><span class="WHIT">    </span><span class="COMM">/**
<span class='line'>164</span>      * 前后移动当前项
<span class='line'>165</span>      * @private
<span class='line'>166</span>      * @function
<span class='line'>167</span>      * @param {int} i 向前、后移动的幅度，正数为向后移动，负数为向前移动
<span class='line'>168</span>      * @returns {int} 是否跳转成功
<span class='line'>169</span>      */</span><span class="WHIT">
<span class='line'>170</span> </span><span class="WHIT">    </span><span class="NAME">movex</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">i</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>171</span> </span><span class="WHIT">        </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">next</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">this.i</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="NAME">i</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>172</span> </span><span class="WHIT">        </span><span class="WHIT">
<span class='line'>173</span> </span><span class="WHIT">        </span><span class="COMM">//限制</span><span class="WHIT">
<span class='line'>174</span> </span><span class="WHIT">        </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">max</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">this.length</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>175</span> </span><span class="WHIT">        </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">next</span><span class="WHIT"> </span><span class="PUNC">>=</span><span class="WHIT"> </span><span class="NAME">max</span><span class="WHIT"> </span><span class="PUNC">||</span><span class="WHIT"> </span><span class="NAME">next</span><span class="WHIT"> </span><span class="PUNC">&lt;</span><span class="WHIT"> </span><span class="NUMB">0</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>176</span> </span><span class="WHIT">            </span><span class="NAME">next</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">next</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="NAME">max</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">%</span><span class="WHIT"> </span><span class="NAME">max</span><span class="WHIT">
<span class='line'>177</span> </span><span class="WHIT">        </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>178</span> </span><span class="WHIT">        </span><span class="COMM">//执行</span><span class="WHIT">
<span class='line'>179</span> </span><span class="WHIT">        </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">this.go</span><span class="PUNC">(</span><span class="NAME">next</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>180</span> </span><span class="WHIT">    </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>181</span> </span><span class="WHIT">    </span><span class="COMM">/**
<span class='line'>182</span>      * 纵向移动当前项
<span class='line'>183</span>      * @private
<span class='line'>184</span>      * @function
<span class='line'>185</span>      * @param {int} i 向前、后移动的幅度，正数为向后移动，负数为向前移动
<span class='line'>186</span>      * @returns {int} 是否跳转成功
<span class='line'>187</span>      */</span><span class="WHIT">
<span class='line'>188</span> </span><span class="WHIT">    </span><span class="NAME">movey</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">i</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>189</span> </span><span class="WHIT">        </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">last</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">this.i2xy</span><span class="PUNC">(</span><span class="NAME">this.length</span><span class="WHIT"> </span><span class="PUNC">-</span><span class="WHIT"> </span><span class="NUMB">1</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>190</span> </span><span class="WHIT">        </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">next</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">this.i2xy</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>191</span> </span><span class="WHIT">        </span><span class="NAME">next.y</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">i</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>192</span> </span><span class="WHIT">        </span><span class="WHIT">
<span class='line'>193</span> </span><span class="WHIT">        </span><span class="COMM">//限制</span><span class="WHIT">
<span class='line'>194</span> </span><span class="WHIT">        </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">max</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">next.x</span><span class="WHIT"> </span><span class="PUNC">></span><span class="WHIT"> </span><span class="NAME">last.x</span><span class="WHIT"> </span><span class="PUNC">?</span><span class="WHIT"> </span><span class="NAME">last.y</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="NAME">last.y</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="NUMB">1</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>195</span> </span><span class="WHIT">        </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">next.y</span><span class="WHIT"> </span><span class="PUNC">>=</span><span class="WHIT"> </span><span class="NAME">max</span><span class="WHIT"> </span><span class="PUNC">||</span><span class="WHIT"> </span><span class="NAME">next.y</span><span class="WHIT"> </span><span class="PUNC">&lt;</span><span class="WHIT"> </span><span class="NUMB">0</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>196</span> </span><span class="WHIT">            </span><span class="NAME">next.y</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">next.y</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="NAME">max</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">%</span><span class="WHIT"> </span><span class="NAME">max</span><span class="WHIT">
<span class='line'>197</span> </span><span class="WHIT">        </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>198</span> </span><span class="WHIT">        </span><span class="WHIT">
<span class='line'>199</span> </span><span class="WHIT">        </span><span class="COMM">//执行</span><span class="WHIT">
<span class='line'>200</span> </span><span class="WHIT">        </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">this.goxy</span><span class="PUNC">(</span><span class="NAME">next</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>201</span> </span><span class="WHIT">    </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>202</span> </span><span class="WHIT">    </span><span class="COMM">/**
<span class='line'>203</span>      * 翻页
<span class='line'>204</span>      * @private
<span class='line'>205</span>      * @function
<span class='line'>206</span>      * @param {int} i 向前、后翻页的幅度，正数为向后翻页，负数为向前翻页
<span class='line'>207</span>      * @returns {int} 是否翻页成功
<span class='line'>208</span>      */</span><span class="WHIT">
<span class='line'>209</span> </span><span class="WHIT">    </span><span class="NAME">movez</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">i</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>210</span> </span><span class="WHIT">        </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">last</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">this.i2xyz</span><span class="PUNC">(</span><span class="NAME">this.length</span><span class="WHIT"> </span><span class="PUNC">-</span><span class="WHIT"> </span><span class="NUMB">1</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>211</span> </span><span class="WHIT">        </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">next</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">this.i2xyz</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>212</span> </span><span class="WHIT">        </span><span class="NAME">next.z</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">i</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>213</span> </span><span class="WHIT">        </span><span class="WHIT">
<span class='line'>214</span> </span><span class="WHIT">        </span><span class="COMM">//限制</span><span class="WHIT">
<span class='line'>215</span> </span><span class="WHIT">        </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">max</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">last.z</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="NUMB">1</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>216</span> </span><span class="WHIT">        </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">next.z</span><span class="WHIT"> </span><span class="PUNC">>=</span><span class="WHIT"> </span><span class="NAME">max</span><span class="WHIT"> </span><span class="PUNC">||</span><span class="WHIT"> </span><span class="NAME">next.z</span><span class="WHIT"> </span><span class="PUNC">&lt;</span><span class="WHIT"> </span><span class="NUMB">0</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>217</span> </span><span class="WHIT">            </span><span class="NAME">next.z</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">next.z</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="NAME">max</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">%</span><span class="WHIT"> </span><span class="NAME">max</span><span class="WHIT">
<span class='line'>218</span> </span><span class="WHIT">        </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>219</span> </span><span class="WHIT">        </span><span class="COMM">//如果此页中选中项目超出有效区域</span><span class="WHIT">
<span class='line'>220</span> </span><span class="WHIT">        </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">this.xyz2i</span><span class="PUNC">(</span><span class="NAME">next</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">>=</span><span class="WHIT"> </span><span class="NAME">this.length</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>221</span> </span><span class="WHIT">            </span><span class="NAME">next</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">last</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>222</span> </span><span class="WHIT">        </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>223</span> </span><span class="WHIT">        </span><span class="COMM">//执行</span><span class="WHIT">
<span class='line'>224</span> </span><span class="WHIT">        </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">this.goxyz</span><span class="PUNC">(</span><span class="NAME">next</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>225</span> </span><span class="WHIT">    </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>226</span> </span><span class="WHIT">    </span><span class="COMM">/**
<span class='line'>227</span>      * 按键响应函数
<span class='line'>228</span>      * @private
<span class='line'>229</span>      * @function
<span class='line'>230</span>      * @param {int} key 按下的键盘码。
<span class='line'>231</span>      */</span><span class="WHIT">
<span class='line'>232</span> </span><span class="WHIT">    </span><span class="NAME">keyPress</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">key</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>233</span> </span><span class="WHIT">        </span><span class="COMM">//默认按键响应</span><span class="WHIT">
<span class='line'>234</span> </span><span class="WHIT">        </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">this.defkey</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>235</span> </span><span class="WHIT">            </span><span class="KEYW">switch</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">key</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>236</span> </span><span class="WHIT">                </span><span class="KEYW">case</span><span class="WHIT"> </span><span class="NAME">keyCodeArr.up</span><span class="PUNC">:</span><span class="WHIT">
<span class='line'>237</span> </span><span class="WHIT">                    </span><span class="NAME">this.movey</span><span class="PUNC">(</span><span class="PUNC">-</span><span class="NUMB">1</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>238</span> </span><span class="WHIT">                    </span><span class="KEYW">break</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>239</span> </span><span class="WHIT">                </span><span class="KEYW">case</span><span class="WHIT"> </span><span class="NAME">keyCodeArr.down</span><span class="PUNC">:</span><span class="WHIT">
<span class='line'>240</span> </span><span class="WHIT">                    </span><span class="NAME">this.movey</span><span class="PUNC">(</span><span class="NUMB">1</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>241</span> </span><span class="WHIT">                    </span><span class="KEYW">break</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>242</span> </span><span class="WHIT">                </span><span class="KEYW">case</span><span class="WHIT"> </span><span class="NAME">keyCodeArr.left</span><span class="PUNC">:</span><span class="WHIT">
<span class='line'>243</span> </span><span class="WHIT">                    </span><span class="NAME">this.movex</span><span class="PUNC">(</span><span class="PUNC">-</span><span class="NUMB">1</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>244</span> </span><span class="WHIT">                    </span><span class="KEYW">break</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>245</span> </span><span class="WHIT">                </span><span class="KEYW">case</span><span class="WHIT"> </span><span class="NAME">keyCodeArr.right</span><span class="PUNC">:</span><span class="WHIT">
<span class='line'>246</span> </span><span class="WHIT">                    </span><span class="NAME">this.movex</span><span class="PUNC">(</span><span class="NUMB">1</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>247</span> </span><span class="WHIT">                    </span><span class="KEYW">break</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>248</span> </span><span class="WHIT">                </span><span class="KEYW">case</span><span class="WHIT"> </span><span class="NAME">keyCodeArr.pageUp</span><span class="PUNC">:</span><span class="WHIT">
<span class='line'>249</span> </span><span class="WHIT">                    </span><span class="NAME">this.movez</span><span class="PUNC">(</span><span class="PUNC">-</span><span class="NUMB">1</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>250</span> </span><span class="WHIT">                    </span><span class="KEYW">break</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>251</span> </span><span class="WHIT">                </span><span class="KEYW">case</span><span class="WHIT"> </span><span class="NAME">keyCodeArr.pageDn</span><span class="PUNC">:</span><span class="WHIT">
<span class='line'>252</span> </span><span class="WHIT">                    </span><span class="NAME">this.movez</span><span class="PUNC">(</span><span class="NUMB">1</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>253</span> </span><span class="WHIT">                    </span><span class="KEYW">break</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>254</span> </span><span class="WHIT">                </span><span class="KEYW">case</span><span class="WHIT"> </span><span class="NAME">keyCodeArr.enter</span><span class="PUNC">:</span><span class="WHIT">
<span class='line'>255</span> </span><span class="WHIT">                    </span><span class="NAME">this.enter</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>256</span> </span><span class="WHIT">                    </span><span class="KEYW">break</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>257</span> </span><span class="WHIT">            </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>258</span> </span><span class="WHIT">        </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>259</span> </span><span class="WHIT">        </span><span class="COMM">//按键响应事件</span><span class="WHIT">
<span class='line'>260</span> </span><span class="WHIT">        </span><span class="NAME">this.onKeyPress</span><span class="WHIT"> </span><span class="PUNC">&&</span><span class="WHIT"> </span><span class="NAME">this.onKeyPress</span><span class="PUNC">(</span><span class="NAME">key</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>261</span> </span><span class="WHIT">    </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>262</span> </span><span class="WHIT">    </span><span class="WHIT">
<span class='line'>263</span> </span><span class="WHIT">    </span><span class="NAME">i</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="NUMB">0</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="WHIT">
<span class='line'>264</span> </span><span class="WHIT">    </span><span class="NAME">w</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="NUMB">3</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="COMM">//菜单项一页行数</span><span class="WHIT">
<span class='line'>265</span> </span><span class="WHIT">    </span><span class="NAME">h</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="NUMB">3</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="COMM">//菜单项一页列数</span><span class="WHIT">
<span class='line'>266</span> </span><span class="WHIT">    </span><span class="NAME">length</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="NUMB">9</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="COMM">//选项的总条目数</span><span class="WHIT">
<span class='line'>267</span> </span><span class="WHIT">    </span><span class="NAME">defkey</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">true</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="COMM">//是否开启默认按键响应</span><span class="WHIT">
<span class='line'>268</span> </span><span class="WHIT">    </span><span class="WHIT">
<span class='line'>269</span> </span><span class="WHIT">    </span><span class="COMM">/**
<span class='line'>270</span>      * 返回本菜单一页能够容纳的item数
<span class='line'>271</span>      * @public
<span class='line'>272</span>      * @function
<span class='line'>273</span>      * @returns {int} item数
<span class='line'>274</span>      */</span><span class="WHIT">
<span class='line'>275</span> </span><span class="WHIT">    </span><span class="NAME">p</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>276</span> </span><span class="WHIT">        </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">this.w</span><span class="WHIT"> </span><span class="PUNC">*</span><span class="WHIT"> </span><span class="NAME">this.h</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>277</span> </span><span class="WHIT">    </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>278</span> </span><span class="WHIT">    </span><span class="COMM">/**
<span class='line'>279</span>      * 获取第i项在其所在行的编号。也就是列号。
<span class='line'>280</span>      * @public
<span class='line'>281</span>      * @function
<span class='line'>282</span>      * @param {int} i 第i项，如果不传参数则默认为当前选中项。
<span class='line'>283</span>      * @returns {int} 列编号
<span class='line'>284</span>      */</span><span class="WHIT">
<span class='line'>285</span> </span><span class="WHIT">    </span><span class="NAME">il</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">i</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>286</span> </span><span class="WHIT">        </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">this.checki</span><span class="PUNC">(</span><span class="NAME">i</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">%</span><span class="WHIT"> </span><span class="NAME">this.w</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>287</span> </span><span class="WHIT">    </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>288</span> </span><span class="WHIT">    </span><span class="COMM">/**
<span class='line'>289</span>      * 获取第i项在其所在页的编号。
<span class='line'>290</span>      * @public
<span class='line'>291</span>      * @function
<span class='line'>292</span>      * @param {int} i 第i项，如果不传参数则默认为当前选中项。
<span class='line'>293</span>      * @returns {int} 编号
<span class='line'>294</span>      */</span><span class="WHIT">
<span class='line'>295</span> </span><span class="WHIT">    </span><span class="NAME">ip</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">i</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>296</span> </span><span class="WHIT">        </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">this.checki</span><span class="PUNC">(</span><span class="NAME">i</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">%</span><span class="WHIT"> </span><span class="NAME">this.p</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>297</span> </span><span class="WHIT">    </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>298</span> </span><span class="WHIT">    </span><span class="COMM">/**
<span class='line'>299</span>      * 获取第i项所在的行编号。
<span class='line'>300</span>      * @public
<span class='line'>301</span>      * @function
<span class='line'>302</span>      * @param {int} i 第i项，如果不传参数则默认为当前选中项。
<span class='line'>303</span>      * @returns {int} 行编号
<span class='line'>304</span>      */</span><span class="WHIT">
<span class='line'>305</span> </span><span class="WHIT">    </span><span class="NAME">y</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">i</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>306</span> </span><span class="WHIT">        </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">Math.floor</span><span class="PUNC">(</span><span class="NAME">this.checki</span><span class="PUNC">(</span><span class="NAME">i</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">/</span><span class="WHIT"> </span><span class="NAME">this.w</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>307</span> </span><span class="WHIT">    </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>308</span> </span><span class="WHIT">    </span><span class="COMM">/**
<span class='line'>309</span>      * 获取第i项在其所在页的行编号。
<span class='line'>310</span>      * @public
<span class='line'>311</span>      * @function
<span class='line'>312</span>      * @param {int} i 第i项，如果不传参数则默认为当前选中项。
<span class='line'>313</span>      * @returns {int} 所在页的行编号
<span class='line'>314</span>      */</span><span class="WHIT">
<span class='line'>315</span> </span><span class="WHIT">    </span><span class="NAME">yp</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">i</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>316</span> </span><span class="WHIT">        </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">Math.floor</span><span class="PUNC">(</span><span class="NAME">this.checki</span><span class="PUNC">(</span><span class="NAME">i</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">/</span><span class="WHIT"> </span><span class="NAME">this.w</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">%</span><span class="WHIT"> </span><span class="NAME">this.h</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>317</span> </span><span class="WHIT">    </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>318</span> </span><span class="WHIT">    </span><span class="COMM">/**
<span class='line'>319</span>      * 获取第i项所在的页编号。
<span class='line'>320</span>      * @public
<span class='line'>321</span>      * @function
<span class='line'>322</span>      * @param {int} i 第i项，如果不传参数则默认为当前选中项。
<span class='line'>323</span>      * @returns {int} 所在的页编号。
<span class='line'>324</span>      */</span><span class="WHIT">
<span class='line'>325</span> </span><span class="WHIT">    </span><span class="NAME">z</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">i</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>326</span> </span><span class="WHIT">        </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">Math.floor</span><span class="PUNC">(</span><span class="NAME">this.checki</span><span class="PUNC">(</span><span class="NAME">i</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">/</span><span class="WHIT"> </span><span class="NAME">this.p</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>327</span> </span><span class="WHIT">    </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>328</span> </span><span class="WHIT">    </span><span class="COMM">/**
<span class='line'>329</span>      * 将i分解为一个包括页、行、列的对象。
<span class='line'>330</span>      * @public
<span class='line'>331</span>      * @function
<span class='line'>332</span>      * @param {int} i 第i项，如果不传参数则默认为当前选中项。
<span class='line'>333</span>      * @returns {object} m 格式为{x:a,y:b,z:c}的对象，其中a为列编号，b为所在页行编号，c为页编号
<span class='line'>334</span>      */</span><span class="WHIT">
<span class='line'>335</span> </span><span class="WHIT">    </span><span class="NAME">i2xyz</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">i</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>336</span> </span><span class="WHIT">        </span><span class="NAME">i</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">this.checki</span><span class="PUNC">(</span><span class="NAME">i</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>337</span> </span><span class="WHIT">        </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>338</span> </span><span class="WHIT">            </span><span class="NAME">x</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="NAME">this.il</span><span class="PUNC">(</span><span class="NAME">i</span><span class="PUNC">)</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>339</span> </span><span class="WHIT">            </span><span class="NAME">y</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="NAME">this.yp</span><span class="PUNC">(</span><span class="NAME">i</span><span class="PUNC">)</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>340</span> </span><span class="WHIT">            </span><span class="NAME">z</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="NAME">this.z</span><span class="PUNC">(</span><span class="NAME">i</span><span class="PUNC">)</span><span class="WHIT">
<span class='line'>341</span> </span><span class="WHIT">        </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>342</span> </span><span class="WHIT">    </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>343</span> </span><span class="WHIT">    </span><span class="COMM">/**
<span class='line'>344</span>      * 将i分解为一个包括行、列的对象。
<span class='line'>345</span>      * @public
<span class='line'>346</span>      * @function
<span class='line'>347</span>      * @param {int} i 第i项，如果不传参数则默认为当前选中项。
<span class='line'>348</span>      * @returns {object} m 格式为{x:a,y:b}的对象，其中a为列编号，b为所在行编号。
<span class='line'>349</span>      */</span><span class="WHIT">
<span class='line'>350</span> </span><span class="WHIT">    </span><span class="NAME">i2xy</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">i</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>351</span> </span><span class="WHIT">        </span><span class="NAME">i</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">this.checki</span><span class="PUNC">(</span><span class="NAME">i</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>352</span> </span><span class="WHIT">        </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>353</span> </span><span class="WHIT">            </span><span class="NAME">x</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="NAME">this.il</span><span class="PUNC">(</span><span class="NAME">i</span><span class="PUNC">)</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>354</span> </span><span class="WHIT">            </span><span class="NAME">y</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="NAME">this.y</span><span class="PUNC">(</span><span class="NAME">i</span><span class="PUNC">)</span><span class="WHIT">
<span class='line'>355</span> </span><span class="WHIT">        </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>356</span> </span><span class="WHIT">    </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>357</span> </span><span class="WHIT">    </span><span class="COMM">/**
<span class='line'>358</span>      * 获取第i项所在的页的第一项的编号。
<span class='line'>359</span>      * @public
<span class='line'>360</span>      * @function
<span class='line'>361</span>      * @param {int} i 第i项，如果不传参数则默认为当前选中项。
<span class='line'>362</span>      * @returns {int} 所在的页的第一项的编号。
<span class='line'>363</span>      */</span><span class="WHIT">
<span class='line'>364</span> </span><span class="WHIT">    </span><span class="NAME">sp</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">i</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>365</span> </span><span class="WHIT">        </span><span class="NAME">i</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">this.checki</span><span class="PUNC">(</span><span class="NAME">i</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>366</span> </span><span class="WHIT">        </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">i</span><span class="WHIT"> </span><span class="PUNC">-</span><span class="WHIT"> </span><span class="NAME">this.ip</span><span class="PUNC">(</span><span class="NAME">i</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>367</span> </span><span class="WHIT">    </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>368</span> </span><span class="WHIT">    </span><span class="COMM">/**
<span class='line'>369</span>      * 获取第i项所在的行的第一项的编号。
<span class='line'>370</span>      * @public
<span class='line'>371</span>      * @function
<span class='line'>372</span>      * @param {int} i 第i项，如果不传参数则默认为当前选中项。
<span class='line'>373</span>      * @returns {int} 所在的行的第一项的编号。
<span class='line'>374</span>      */</span><span class="WHIT">
<span class='line'>375</span> </span><span class="WHIT">    </span><span class="NAME">sl</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">i</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>376</span> </span><span class="WHIT">        </span><span class="NAME">i</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">this.checki</span><span class="PUNC">(</span><span class="NAME">i</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>377</span> </span><span class="WHIT">        </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">i</span><span class="WHIT"> </span><span class="PUNC">-</span><span class="WHIT"> </span><span class="NAME">this.il</span><span class="PUNC">(</span><span class="NAME">i</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>378</span> </span><span class="WHIT">    </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>379</span> </span><span class="WHIT">    </span><span class="WHIT">
<span class='line'>380</span> </span><span class="WHIT">    </span><span class="WHIT">
<span class='line'>381</span> </span><span class="WHIT">    </span><span class="WHIT">
<span class='line'>382</span> </span><span class="WHIT">    </span><span class="WHIT">
<span class='line'>383</span> </span><span class="WHIT">    </span><span class="COMM">/**
<span class='line'>384</span>      * 打开这个menu,使其受到键盘控制,会触发onOpen事件。
<span class='line'>385</span>      * @public
<span class='line'>386</span>      * @function
<span class='line'>387</span>      * @returns {boolean} 是否打开成功
<span class='line'>388</span>      */</span><span class="WHIT">
<span class='line'>389</span> </span><span class="WHIT">    </span><span class="NAME">open</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>390</span> </span><span class="WHIT">        </span><span class="NAME">common.key.change</span><span class="PUNC">(</span><span class="KEYW">this</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>391</span> </span><span class="WHIT">        </span><span class="COMM">//触发onOpen</span><span class="WHIT">
<span class='line'>392</span> </span><span class="WHIT">        </span><span class="NAME">this.onOpen</span><span class="WHIT"> </span><span class="PUNC">&&</span><span class="WHIT"> </span><span class="NAME">this.onOpen</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="WHIT">
<span class='line'>393</span> </span><span class="WHIT">		</span><span class="KEYW">return</span><span class="WHIT"> </span><span class="KEYW">true</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>394</span> </span><span class="WHIT">    </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">    </span><span class="WHIT">
<span class='line'>395</span> </span><span class="WHIT">    </span><span class="COMM">/**
<span class='line'>396</span>      * 关闭这个menu,使其不受键盘控制,会触发onClose事件
<span class='line'>397</span>      * @public
<span class='line'>398</span>      * @function
<span class='line'>399</span>      * @returns {boolean} 是否关闭成功
<span class='line'>400</span>      */</span><span class="WHIT">
<span class='line'>401</span> </span><span class="WHIT">    </span><span class="NAME">close</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>402</span> </span><span class="WHIT">        </span><span class="NAME">common.key.unbind</span><span class="PUNC">(</span><span class="KEYW">this</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>403</span> </span><span class="WHIT">        </span><span class="COMM">//触发onClose</span><span class="WHIT">
<span class='line'>404</span> </span><span class="WHIT">        </span><span class="NAME">this.onClose</span><span class="WHIT"> </span><span class="PUNC">&&</span><span class="WHIT"> </span><span class="NAME">this.onClose</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="WHIT">
<span class='line'>405</span> </span><span class="WHIT">		</span><span class="KEYW">return</span><span class="WHIT"> </span><span class="KEYW">true</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>406</span> </span><span class="WHIT">    </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>407</span> </span><span class="WHIT">    </span><span class="COMM">/**
<span class='line'>408</span>      * 菜单跳转到第i项。
<span class='line'>409</span>      * @public
<span class='line'>410</span>      * @function
<span class='line'>411</span>      * @param {int} i 第i项。
<span class='line'>412</span>      * @returns {boolean} 是否跳转成功
<span class='line'>413</span>      */</span><span class="WHIT">
<span class='line'>414</span> </span><span class="WHIT">    </span><span class="NAME">go</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">i</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>415</span> </span><span class="WHIT">        </span><span class="COMM">//common.log("移动光标到 " + i);</span><span class="WHIT">
<span class='line'>416</span> </span><span class="WHIT">        </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="KEYW">typeof</span><span class="PUNC">(</span><span class="NAME">i</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">===</span><span class="WHIT"> </span><span class="STRN">"number"</span><span class="WHIT"> </span><span class="PUNC">&&</span><span class="WHIT"> </span><span class="NAME">i</span><span class="WHIT"> </span><span class="PUNC">>=</span><span class="WHIT"> </span><span class="NUMB">0</span><span class="WHIT"> </span><span class="PUNC">&&</span><span class="WHIT"> </span><span class="NAME">i</span><span class="WHIT"> </span><span class="PUNC">&lt;</span><span class="WHIT"> </span><span class="NAME">this.length</span><span class="WHIT"> </span><span class="PUNC">&&</span><span class="WHIT"> </span><span class="NAME">this.i</span><span class="WHIT"> </span><span class="PUNC">!=</span><span class="WHIT"> </span><span class="NAME">i</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>417</span> </span><span class="WHIT">            </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">p</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">this.i</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>418</span> </span><span class="WHIT">            </span><span class="NAME">this.i</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">i</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>419</span> </span><span class="WHIT">            </span><span class="COMM">//触发onLineChange</span><span class="WHIT">
<span class='line'>420</span> </span><span class="WHIT">            </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">this.i2xyz</span><span class="PUNC">(</span><span class="NAME">p</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">z</span><span class="WHIT"> </span><span class="PUNC">!=</span><span class="WHIT"> </span><span class="NAME">this.i2xyz</span><span class="PUNC">(</span><span class="NAME">i</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">z</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>421</span> </span><span class="WHIT">                </span><span class="NAME">this.onPageChange</span><span class="WHIT"> </span><span class="PUNC">&&</span><span class="WHIT"> </span><span class="NAME">this.onPageChange</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>422</span> </span><span class="WHIT">            </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>423</span> </span><span class="WHIT">            </span><span class="COMM">//触发onPageChange</span><span class="WHIT">
<span class='line'>424</span> </span><span class="WHIT">            </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">this.i2xy</span><span class="PUNC">(</span><span class="NAME">p</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">y</span><span class="WHIT"> </span><span class="PUNC">!=</span><span class="WHIT"> </span><span class="NAME">this.i2xy</span><span class="PUNC">(</span><span class="NAME">i</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">y</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>425</span> </span><span class="WHIT">                </span><span class="NAME">this.onLineChange</span><span class="WHIT"> </span><span class="PUNC">&&</span><span class="WHIT"> </span><span class="NAME">this.onLineChange</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>426</span> </span><span class="WHIT">            </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>427</span> </span><span class="WHIT">            </span><span class="COMM">//触发onChange</span><span class="WHIT">
<span class='line'>428</span> </span><span class="WHIT">            </span><span class="NAME">this.onChange</span><span class="WHIT"> </span><span class="PUNC">&&</span><span class="WHIT"> </span><span class="NAME">this.onChange</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>429</span> </span><span class="WHIT">            </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="KEYW">true</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>430</span> </span><span class="WHIT">        </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>431</span> </span><span class="WHIT">        </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="KEYW">false</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>432</span> </span><span class="WHIT">    </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>433</span> </span><span class="WHIT">    </span><span class="COMM">/**
<span class='line'>434</span>      * 菜单按行列方式跳转
<span class='line'>435</span>      * @public
<span class='line'>436</span>      * @function
<span class='line'>437</span>      * @param {objec} m 格式为{x:a,y:b}的对象，其中a为列编号，b为所在行编号。
<span class='line'>438</span>      * @returns {boolean} 是否跳转成功
<span class='line'>439</span>      */</span><span class="WHIT">
<span class='line'>440</span> </span><span class="WHIT">    </span><span class="NAME">goxy</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">m</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>441</span> </span><span class="WHIT">        </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">this.go</span><span class="PUNC">(</span><span class="NAME">this.xy2i</span><span class="PUNC">(</span><span class="NAME">m</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>442</span> </span><span class="WHIT">    </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>443</span> </span><span class="WHIT">    </span><span class="COMM">/**
<span class='line'>444</span>      * 菜单按页行列方式跳转
<span class='line'>445</span>      * @public
<span class='line'>446</span>      * @function
<span class='line'>447</span>      * @param {object} m 格式为{x:a,y:b,z:c}的对象，其中a为列编号，b为所在页行编号，c为页编号
<span class='line'>448</span>      * @returns {boolean} 是否跳转成功
<span class='line'>449</span>      */</span><span class="WHIT">
<span class='line'>450</span> </span><span class="WHIT">    </span><span class="NAME">goxyz</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">m</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>451</span> </span><span class="WHIT">        </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">this.go</span><span class="PUNC">(</span><span class="NAME">this.xyz2i</span><span class="PUNC">(</span><span class="NAME">m</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>452</span> </span><span class="WHIT">    </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>453</span> </span><span class="WHIT">    </span><span class="COMM">/**
<span class='line'>454</span>      * 跳转到上一项
<span class='line'>455</span>      * @public
<span class='line'>456</span>      * @function
<span class='line'>457</span>      * @returns {boolean} 是否跳转成功
<span class='line'>458</span>      */</span><span class="WHIT">
<span class='line'>459</span> </span><span class="WHIT">    </span><span class="NAME">prev</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>460</span> </span><span class="WHIT">        </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">this.movex</span><span class="PUNC">(</span><span class="PUNC">-</span><span class="NUMB">1</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>461</span> </span><span class="WHIT">    </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>462</span> </span><span class="WHIT">    </span><span class="COMM">/**
<span class='line'>463</span>      * 跳转到下一项
<span class='line'>464</span>      * @public
<span class='line'>465</span>      * @function
<span class='line'>466</span>      * @returns {boolean} 是否跳转成功
<span class='line'>467</span>      */</span><span class="WHIT">
<span class='line'>468</span> </span><span class="WHIT">    </span><span class="NAME">next</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>469</span> </span><span class="WHIT">        </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">this.movex</span><span class="PUNC">(</span><span class="NUMB">1</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>470</span> </span><span class="WHIT">    </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>471</span> </span><span class="WHIT">    </span><span class="COMM">/**
<span class='line'>472</span>      * 跳转到上一行
<span class='line'>473</span>      * @public
<span class='line'>474</span>      * @function
<span class='line'>475</span>      * @returns {boolean} 是否跳转成功
<span class='line'>476</span>      */</span><span class="WHIT">
<span class='line'>477</span> </span><span class="WHIT">    </span><span class="NAME">prevLine</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>478</span> </span><span class="WHIT">        </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">this.movey</span><span class="PUNC">(</span><span class="PUNC">-</span><span class="NUMB">1</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>479</span> </span><span class="WHIT">    </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>480</span> </span><span class="WHIT">    </span><span class="COMM">/**
<span class='line'>481</span>      * 跳转到下一行
<span class='line'>482</span>      * @public
<span class='line'>483</span>      * @function
<span class='line'>484</span>      * @returns {boolean} 是否跳转成功
<span class='line'>485</span>      */</span><span class="WHIT">
<span class='line'>486</span> </span><span class="WHIT">    </span><span class="NAME">nextLine</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>487</span> </span><span class="WHIT">        </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">this.movey</span><span class="PUNC">(</span><span class="NUMB">1</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>488</span> </span><span class="WHIT">    </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>489</span> </span><span class="WHIT">    </span><span class="COMM">/**
<span class='line'>490</span>      * 跳转到上一页
<span class='line'>491</span>      * @public
<span class='line'>492</span>      * @function
<span class='line'>493</span>      * @returns {boolean} 是否跳转成功
<span class='line'>494</span>      */</span><span class="WHIT">
<span class='line'>495</span> </span><span class="WHIT">    </span><span class="NAME">prevPage</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>496</span> </span><span class="WHIT">        </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">this.movez</span><span class="PUNC">(</span><span class="PUNC">-</span><span class="NUMB">1</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>497</span> </span><span class="WHIT">    </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>498</span> </span><span class="WHIT">    </span><span class="COMM">/**
<span class='line'>499</span>      * 跳转到下一页
<span class='line'>500</span>      * @public
<span class='line'>501</span>      * @function
<span class='line'>502</span>      * @returns {boolean} 是否跳转成功
<span class='line'>503</span>      */</span><span class="WHIT">
<span class='line'>504</span> </span><span class="WHIT">    </span><span class="NAME">nextPage</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>505</span> </span><span class="WHIT">        </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">this.movez</span><span class="PUNC">(</span><span class="NUMB">1</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>506</span> </span><span class="WHIT">    </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>507</span> </span><span class="WHIT">    </span><span class="COMM">/**
<span class='line'>508</span>      * 进入当前项
<span class='line'>509</span>      * @public
<span class='line'>510</span>      * @function
<span class='line'>511</span>      * @returns {boolean} 是否跳转成功
<span class='line'>512</span>      */</span><span class="WHIT">
<span class='line'>513</span> </span><span class="WHIT">    </span><span class="NAME">enter</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>514</span> </span><span class="WHIT">        </span><span class="NAME">this.onEnter</span><span class="WHIT"> </span><span class="PUNC">&&</span><span class="WHIT"> </span><span class="NAME">this.onEnter</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>515</span> </span><span class="WHIT">		</span><span class="KEYW">return</span><span class="WHIT"> </span><span class="KEYW">true</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>516</span> </span><span class="WHIT">    </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>517</span> </span><span class="WHIT">	</span><span class="WHIT">
<span class='line'>518</span> </span><span class="WHIT">	</span><span class="WHIT">
<span class='line'>519</span> </span><span class="WHIT">    </span><span class="COMM">/**
<span class='line'>520</span>      * 菜单被打开，执行open方法时触发
<span class='line'>521</span> 	 * @event
<span class='line'>522</span>      */</span><span class="WHIT">
<span class='line'>523</span> </span><span class="WHIT">	</span><span class="NAME">onOpen</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>524</span> </span><span class="WHIT">    </span><span class="COMM">/**
<span class='line'>525</span>      * 菜单被关闭，执行close方法时触发
<span class='line'>526</span> 	 * @event
<span class='line'>527</span>      */</span><span class="WHIT">
<span class='line'>528</span> </span><span class="WHIT">	</span><span class="NAME">onClose</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>529</span> </span><span class="WHIT">    </span><span class="COMM">/**
<span class='line'>530</span>      * 进入菜单项，执行enter方法时触发（默认回车键触发）
<span class='line'>531</span> 	 * @event
<span class='line'>532</span>      */</span><span class="WHIT">
<span class='line'>533</span> </span><span class="WHIT">	</span><span class="NAME">onEnter</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>534</span> </span><span class="WHIT">    </span><span class="COMM">/**
<span class='line'>535</span>      * 选中项改变时触发
<span class='line'>536</span> 	 * @event
<span class='line'>537</span>      */</span><span class="WHIT">
<span class='line'>538</span> </span><span class="WHIT">	</span><span class="NAME">onChange</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>539</span> </span><span class="WHIT">    </span><span class="COMM">/**
<span class='line'>540</span>      * 选中项换行时触发
<span class='line'>541</span> 	 * @event
<span class='line'>542</span>      */</span><span class="WHIT">
<span class='line'>543</span> </span><span class="WHIT">	</span><span class="NAME">onLineChange</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>544</span> </span><span class="WHIT">    </span><span class="COMM">/**
<span class='line'>545</span>      * 选中项换页时触发
<span class='line'>546</span> 	 * @event
<span class='line'>547</span>      */</span><span class="WHIT">
<span class='line'>548</span> </span><span class="WHIT">	</span><span class="NAME">onPageChange</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>549</span> </span><span class="WHIT">    </span><span class="COMM">/**
<span class='line'>550</span>      * 菜单被open后，有按键时触发，传入按键码
<span class='line'>551</span> 	 * @event
<span class='line'>552</span>      * @param {int} key 按键码
<span class='line'>553</span>      */</span><span class="WHIT">
<span class='line'>554</span> </span><span class="WHIT">	</span><span class="NAME">onKeyPress</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>555</span> </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>556</span> </span></pre></body></html>